<%- include('head') -%>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
  <div class="layui-header">
    <div class="layui-logo">layui 后台布局</div>
    <!-- 头部区域（可配合layui已有的水平导航） -->
    <ul class="layui-nav layui-layout-left">
      <li class="layui-nav-item"><a href="">控制台</a></li>
      <li class="layui-nav-item"><a href="">商品管理</a></li>
      <li class="layui-nav-item"><a href="">用户</a></li>
      <li class="layui-nav-item">
        <a href="javascript:;">其它系统</a>
        <dl class="layui-nav-child">
          <dd><a href="">邮件管理</a></dd>
          <dd><a href="">消息管理</a></dd>
          <dd><a href="">授权管理</a></dd>
        </dl>
      </li>
    </ul>
    <ul class="layui-nav layui-layout-right">
      <li class="layui-nav-item">
        <a href="javascript:;">
          <img src="<%= userInfo.avatar %>" class="layui-nav-img">
          <%= userInfo.userName %>
        </a>
        <dl class="layui-nav-child">
          <dd><a href="">基本资料</a></dd>
          <dd><a href="">安全设置</a></dd>
        </dl>
      </li>
      <li class="layui-nav-item"><a href="javascript:;" class="logout">退了</a></li>
    </ul>
  </div>
  
  <div class="layui-side layui-bg-black">
    <div class="layui-side-scroll">
      <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
      <ul class="layui-nav layui-nav-tree"  lay-filter="test">
        <li class="layui-nav-item"><a class="link" href="javascript:;" data-href="/cateList">分类列表</a></li>
        <li class="layui-nav-item"><a class="link" href="javascript:;" data-href="/main">仪表盘</a></li>
        <li class="layui-nav-item"><a class="link" href="javascript:;" data-href="/setting">设置</a></li>
      </ul>
    </div>
  </div>
  
  <div class="layui-body" style="overflow: hidden;">
    <!-- 内容主体区域 -->
    <div style="height:100%;padding:15px;box-sizing: border-box;">
      <iframe id="frame" width="100%" height="100%" src="/main" frameborder="0"></iframe>
    </div>
  </div>
  
  <div class="layui-footer">
    <!-- 底部固定区域 -->
    © layui.com - 底部固定区域
  </div>
</div>
<%- include('footer') -%>
<script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
<script>
//JavaScript代码区域
layui.use(['element','jquery','layer'], function(){
  var element = layui.element;
  var $ = layui.jquery;
  var layer = layui.layer;
  // 退出登录
  $(".logout").click(function(){
    // confirm
    layer.confirm('是否退出登录?', {icon: 3, title:'走了'}, function(index){
      //do something
      Cookies.remove('userInfo');
      history.go(0);
      layer.close(index);
    });
  })
  $(".link").click(function(){
    // alert(this.dataset.href)
    $("#frame").attr('src',this.dataset.href)
  })
});
</script>
</body>
</html>